home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / Timer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  3.4 KB  |  136 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Timer.h
  3.  
  4.      Contains:    Time Manager interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1985-1993, 1995-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __TIMER__
  18. #define __TIMER__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21. #include <ConditionalMacros.h>
  22. #endif
  23. #ifndef __MACTYPES__
  24. #include <MacTypes.h>
  25. #endif
  26. #ifndef __OSUTILS__
  27. #include <OSUtils.h>
  28. #endif
  29.  
  30.  
  31.  
  32. #if PRAGMA_ONCE
  33. #pragma once
  34. #endif
  35.  
  36. #ifdef __cplusplus
  37. extern "C" {
  38. #endif
  39.  
  40. #if PRAGMA_IMPORT
  41. #pragma import on
  42. #endif
  43.  
  44. #if PRAGMA_STRUCT_ALIGN
  45.     #pragma options align=mac68k
  46. #elif PRAGMA_STRUCT_PACKPUSH
  47.     #pragma pack(push, 2)
  48. #elif PRAGMA_STRUCT_PACK
  49.     #pragma pack(2)
  50. #endif
  51.  
  52.  
  53. enum {
  54.                                                                 /* high bit of qType is set if task is active */
  55.     kTMTaskActive                = (1L << 15)
  56. };
  57.  
  58. typedef struct TMTask                     TMTask;
  59. typedef TMTask *                        TMTaskPtr;
  60. typedef CALLBACK_API( void , TimerProcPtr )(TMTaskPtr tmTaskPtr);
  61. /*
  62.     WARNING: TimerProcPtr uses register based parameters under classic 68k
  63.              and cannot be written in a high-level language without 
  64.              the help of mixed mode or assembly glue.
  65. */
  66. typedef REGISTER_UPP_TYPE(TimerProcPtr)                         TimerUPP;
  67.  
  68. struct TMTask {
  69.     QElemPtr                         qLink;
  70.     short                             qType;
  71.     TimerUPP                         tmAddr;
  72.     long                             tmCount;
  73.     long                             tmWakeUp;
  74.     long                             tmReserved;
  75. };
  76.  
  77.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  78.                                                                                             #pragma parameter InsTime(__A0)
  79.                                                                                             #endif
  80. EXTERN_API( void )
  81. InsTime                            (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA058);
  82.  
  83.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  84.                                                                                             #pragma parameter InsXTime(__A0)
  85.                                                                                             #endif
  86. EXTERN_API( void )
  87. InsXTime                        (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA458);
  88.  
  89.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  90.                                                                                             #pragma parameter PrimeTime(__A0, __D0)
  91.                                                                                             #endif
  92. EXTERN_API( void )
  93. PrimeTime                        (QElemPtr                 tmTaskPtr,
  94.                                  long                     count)                                ONEWORDINLINE(0xA05A);
  95.  
  96.                                                                                             #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  97.                                                                                             #pragma parameter RmvTime(__A0)
  98.                                                                                             #endif
  99. EXTERN_API( void )
  100. RmvTime                            (QElemPtr                 tmTaskPtr)                            ONEWORDINLINE(0xA059);
  101.  
  102. EXTERN_API( void )
  103. Microseconds                    (UnsignedWide *            microTickCount)                        FOURWORDINLINE(0xA193, 0x225F, 0x22C8, 0x2280);
  104.  
  105. enum { uppTimerProcInfo = 0x0000B802 };                         /* register no_return_value Func(4_bytes:A1) */
  106. #define NewTimerProc(userRoutine)                                 (TimerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppTimerProcInfo, GetCurrentArchitecture())
  107. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  108.     #pragma parameter CallTimerProc(__A0, __A1)
  109.     void CallTimerProc(TimerUPP routine, TMTaskPtr tmTaskPtr) = 0x4E90;
  110. #else
  111.     #define CallTimerProc(userRoutine, tmTaskPtr)                 CALL_ONE_PARAMETER_UPP((userRoutine), uppTimerProcInfo, (tmTaskPtr))
  112. #endif
  113.  
  114.  
  115.  
  116. #if PRAGMA_STRUCT_ALIGN
  117.     #pragma options align=reset
  118. #elif PRAGMA_STRUCT_PACKPUSH
  119.     #pragma pack(pop)
  120. #elif PRAGMA_STRUCT_PACK
  121.     #pragma pack()
  122. #endif
  123.  
  124. #ifdef PRAGMA_IMPORT_OFF
  125. #pragma import off
  126. #elif PRAGMA_IMPORT
  127. #pragma import reset
  128. #endif
  129.  
  130. #ifdef __cplusplus
  131. }
  132. #endif
  133.  
  134. #endif /* __TIMER__ */
  135.  
  136.